$.ajax({
url:"./php/adall.php",
dataType:"JSON",
success: function(data){
    var str ="<tr><th>文件名</th><th>上传时间</th><th>所属科目</th><th>所属年份</th><th>操作</th></tr>";
        for(var k in data)
        {   
            str = str+"<td><a href=\"./php/adminView.php?Name="+data[k].name+"\">"+data[k].name+"</a></td>";
            str = str+"<td>"+data[k].uploadtime+"</td>";
            str = str+"<td>"+data[k].subject+"</td>";
            str = str+"<td>"+data[k].year+"</td>";
            str = str+"<td><button onclick=\"pass('"+data[k].name+"')\">通过</button><button onclick=\"fail('"+data[k].name+"')\">不通过</button></td></tr>";
        }
        $("#test").html(str);
    }
});
function pass(name){
    console.log(name);
    $.ajax({
        type:'POST',
        url:"./php/pass.php",
        data:{name:name},
        dataType:"JSON",
        success: function(data){
            var str ="<tr><th>文件名</th><th>上传时间</th><th>所属科目</th><th>所属年份</th><th>操作</th></tr>";
            for(var k in data)
            {
                str = str+"<td><a href=\"./php/adminView.php?Name="+data[k].name+"\">"+data[k].name+"</a></td>";
                str = str+"<td>"+data[k].uploadtime+"</td>";
                str = str+"<td>"+data[k].subject+"</td>";
                str = str+"<td>"+data[k].year+"</td>";
                str = str+"<td><button onclick=\"pass('"+data[k].name+"')\">通过</button><button onclick=\"fail('"+data[k].name+"')\">不通过</button></td></tr>";
            }
          $("#test").html(str);
        }
    });
};
function fail(name){
    console.log(name);
    $.ajax({
        type:'POST',
        url:"./php/fail.php",
        data:{name:name},
        dataType:"JSON",
        success: function(data){
            var str ="<tr><th>文件名</th><th>上传时间</th><th>所属科目</th><th>所属年份</th><th>操作</th></tr>";
            for(var k in data)
            {
                str = str+"<td><a href=\"./php/adminView.php?Name="+data[k].name+"\">"+data[k].name+"</a></td>";
                str = str+"<td>"+data[k].uploadtime+"</td>";
                str = str+"<td>"+data[k].subject+"</td>";
                str = str+"<td>"+data[k].year+"</td>";
                str = str+"<td><button onclick=\"pass('"+data[k].name+"')\">通过</button><button onclick=\"fail('"+data[k].name+"')\">不通过</button></td></tr>";
            }
          $("#test").html(str);
        }
    });
};

